<template>
	<view>
		<view class="tp-h88 level_align tp-ptb0lr30 tp-bgf flex_between tp-mb2">
			<view class="level_align tp-fc333 tp-fz32">
				支付宝账号
			</view>
			<view class="level_align flex_end">
				<input class="tp-tr" type="text" v-model="number" value="" placeholder="请输入支付宝账号" />
			</view>
		</view>
		<view class="tp-h88 level_align tp-ptb0lr30 tp-bgf flex_between">
			<view class="level_align tp-fc333 tp-fz32">
				真实姓名
			</view>
			<view class="level_align flex_end">
				<input class="tp-tr" type="text" v-model="name" value="" placeholder="请输入真实姓名" />
			</view>
		</view>

		<view class="tp-h64"></view>
		<view @click="confirm" class="tp-btn-h88 tp-w690 tp-mt80">确定</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: '', // 姓名
				number: '', // 账号
			};
		},
		onShow() {

		},
		methods: {
			// 确定
			async confirm() {
				if (!this.number) {
					return uni.showToast({
						icon: 'none',
						title: '请填写支付宝账号'
					});
				}
				if (!this.name) {
					return uni.showToast({
						icon: 'none',
						title: '请填写真实姓名'
					});
				}
				this.$http.get(this.$api.addUserAccount, {
					type: 1,
					realName: this.name,
					number: this.number,
				}).then(res => {
					if (res.code === 200) {
						uni.showToast({
							title: '绑定成功',
							icon: 'none'
						})
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 1500)

					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
